<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function isPrime(n) {
            if (n <= 3) {
                return n > 1;
            }
            if (n % 2 == 0 || n % 3 == 0) {
                return false;
            }

            for (var i = 5; i * i <= n; i += 6) {
                if (n % i == 0 || n % (i + 2 == 0)) {
                    return false;
                }
            }
            return true;
        }
        var num = prompt('请输入一个数');
        alert(isPrime(parseFloat(num)));
    </script>
</head>

<body>

</body>

</html>